<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
    	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	    <title>网点管理</title>
	    <meta name="description" content="防伪溯源">
	    <link rel="stylesheet" href="css/AllStyle.css" />
	    <link rel="stylesheet" href="css/iconfont.css" />
	    <script type="text/javascript" src="js/common.js" ></script>
	    <script type="text/javascript" src="js/companydata.js" ></script>
	    <script type="text/javascript" src="js/data.js" ></script>
	    <script type="text/javascript" src="js/tmpl.js" ></script>
	</head>
	<body>
		<!-- 页头 -->
	    <section>
		    <script type="text/javascript">
		        AllPageHeader()
		    </script>
	    </section>
	    
	    <!-- 页面  -->
	    <section class="AllContent" style="background-color: #fff;">
	    	<div id="ScreentoneList">
	    		<img style="width: 40%;margin:20px auto;display: block;" src="images/loading5.gif">
	    	</div>
	    </section>
	</body>
	<script type="text/javascript" src="js/jquery.min.js" ></script>
	<script type="text/javascript" src="js/mui.min.js" ></script>
	<script type="text/javascript" src="js/bootstrap-paginator.js" ></script>
	<script type="text/javascript">
		$('.AllHeader li:eq(1)').text('网点列表')
		$('.AllHeader li:eq(2)').html('<img class="AddBranch" style="width:22px" src="images/addproducts.png">')
		//添加网点
		$(".AddBranch").on('tap',function(){
		  mui.openWindow({
		    url: 'AddBranch.html', 
		    id:'AddBranch.html'
		  });
		});
		
	    $(function () {
	        document.addEventListener('deviceready', onDeviceReady, true);
	        loadBranch();
            getpic('全部',1);
	    });
	    var branchlist = false;
	    function onDeviceReady() {
	        document.addEventListener("backbutton", onBackKeyDown, false);
	    }
	    function onBackKeyDown() {
	        openUrl("index.html");
	    }
	    function queryBranch() {
	        var q = $("#query").val();
	        if (empty(q)) {
	            loadBranch();
	        } else {
	            $.ajax({
	                type: "post",
	                url: getServerUrl() + "/Open/Company/catbranch",
	                dataType: 'json',
	                data: 'access_token=' + getToken()+'&name='+q,
	                success: function (json) {
	                    if(json.result == "1"){
	                        showBranch(json.branchlist);
	                        $("#pageUl").html("");
	                    }else{
	                        alertMessage(json.error_description);
	                    }
	
	                },
	                error: function () {
	                    alertMessage("请检查网络连接！");
	                }
	            });
	
	        }
	    }
	
	    function removebranch(bid) {
	        var r = confirm("请确认是否删除网点?")
	        if (r === true)
	        {
	            $.ajax({
	                type: "post",
	                url: getServerUrl() + "/Open/Company/delbranch",
	                dataType: 'json',
	                data:"access_token="+getToken()+ '&bid=' + bid,
	                success: function (json) {
	                    if (json.result == "1") {
	                        alertMessage("删除网点完成！");
	                        loadBranch();
	                    } else {
	                        alertMessage("删除网点错误:[" + json.error_description + "]");
	                    }
	                }
	            });
	        }
	
	    }
	    function manage(id,name){
	        setBranchId(id);
	        setCookie("wms.branchname",name);
	        openUrl("BranchUser.html");
	    }
		
	</script>
</html>
